#include "FindPwdSuccessOverDlg.h"

#include <core/ImageMgr.h>
#include <core/StyleMgr.h>
#include <widgets/SLineEdit.h>
#include <widgets/SPopupWindow.h>

#include <QGridLayout>
#include <QLabel>
#include <QPaintDevice>
#include <QPainter>
#include <QPushButton>
#include <QSpacerItem>
#include <QStylePainter>
#include <QWidget>

FindPwdSuccessOverDlg::FindPwdSuccessOverDlg(QWidget* p /*= nullptr*/)
    : QWidget(p) {
  // step_4: 成功更改
  QVBoxLayout* vL = new QVBoxLayout(this);
  vL->setContentsMargins(0, 56, 0, 0);

  QLabel* imageLabel = new QLabel(this);
  SImage* loginConfirmImg = ImgMgr::instance().image(
      "auth_login_confirm", WidgetStatus::kNormal, devicePixelRatioF());
  if (loginConfirmImg)
    imageLabel->setPixmap(QPixmap::fromImage(*loginConfirmImg));
  vL->addWidget(imageLabel, 0, Qt::AlignCenter);
  vL->addSpacing(10);

  QLabel* successChangePwd = new QLabel(tr("重置密码成功"), this);
  successChangePwd->setStyleSheet(
      QString("font:15px;color:#%1")
          .arg(StyleMgr::instance().color("Down_Reduce_H1").rgb(), 0, 16));
  vL->addWidget(successChangePwd, 0, Qt::AlignCenter);
  vL->addSpacing(30);

  QLabel* changePwd = new QLabel(tr("您的密码已重置，请重新登录。"), this);
  changePwd->setStyleSheet(
      QString("font:15px;color:#%1")
          .arg(StyleMgr::instance().color("SupportingWord").rgb(), 0, 16));
  vL->addWidget(changePwd, 0, Qt::AlignCenter);
  vL->addSpacing(46);

  m_reLogin = new QPushButton(tr("重新登录"), this);
  m_reLogin->setFixedSize(120, 24);
  vL->addWidget(m_reLogin, 0, Qt::AlignCenter);
}
